package com.iwhalecloud.bss.kite.cucc.service.pay;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.iwhalecloud.bss.kite.cucc.client.api.order.IOrderService;
import com.iwhalecloud.bss.kite.cucc.client.dto.pos.KitePosDetailDTO;
import com.ztesoft.bss.common.util.SpringUtil;

import java.util.Map;
import java.util.concurrent.Callable;

/**
 * @Description
 * @Author deng.gang
 * @Date 2021/7/14 上午11:08
 */
public class QryOrderDetailCallTask implements Callable<KitePosDetailDTO> {

    private String orderId;

    public QryOrderDetailCallTask(String orderId) {
        this.orderId = orderId;
    }

    @Override
    public KitePosDetailDTO call() throws Exception {
        IOrderService orderService = SpringUtil.getBean(IOrderService.class);
        Map<String, Object> orderInfoMap = orderService.getOrderDetail(orderId);
        KitePosDetailDTO kitePosDTO = JSONObject.toJavaObject(JSON.parseObject(JSON.toJSONString(orderInfoMap)), KitePosDetailDTO.class);
        kitePosDTO.setOrderId(orderId);
        return kitePosDTO;
    }
}
